package com.tn.controller.securewhitelist;


import com.gitee.hifong45.Ret;

import com.tn.dao.mbpdao.SecureWhitelist;
import com.tn.service.securewhitelist.SecureWhitelistService;
import com.tn.utils.JsonUtil;
import lombok.extern.log4j.Log4j2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author YuzSuzuki
 * @since 2023-06-01
 */
@RestController
@RequestMapping("/secureWhitelist")
@Slf4j
public class SecureWhitelistController {

    @Autowired
    private SecureWhitelistService secureWhitelistService;

    @RequestMapping("/addWhiteListMember")
    public Ret<Object> addWhiteListMember(@RequestBody List<SecureWhitelist> members) {
        log.info("白名单添加："+JsonUtil.obj2String(members));
        secureWhitelistService.saveBatch(members);
        return Ret.Ok();
    }


    @RequestMapping("/cancelWhiteListMember")
    public Ret<Object> cancelWhiteListMember(@RequestBody List<String> license) {
        secureWhitelistService.cancelWhiteListMember(license);
        return Ret.Ok();
    }

    @RequestMapping("/updateWhiteListMember")
    public Ret<Object> updateWhiteListMember(@RequestBody SecureWhitelist secureWhitelist) {

        secureWhitelistService.updateWhiteListMember(secureWhitelist);
        return Ret.Ok();
    }
}

